package com.bookstore.admin.orders.service;

import com.bookstore.admin.orders.dao.IOrdersDao;
import com.bookstore.commons.beans.Order;
import com.bookstore.commons.beans.OrderItem;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;
@Service
public class IOdersServiceImpl implements IOrdersService {

    @Resource
    IOrdersDao ordersDao;


    @Override
    public List<Order> findAllorders() {
        return ordersDao.selectAllOrders();
    }

    @Override
    public List<Order> findOrderByManyCondition(Order order) {
        return ordersDao.selectByManyCondition(order);
    }

    @Override
    public Order selectOrderById(Order order) {
        return ordersDao.selectOrderById(order);
    }

    @Override
    public List<OrderItem> findOrderItemById(String id) {
        return ordersDao.selectOrderItemById(id);
    }

    @Override
    public void removeOrders(String id) {
        ordersDao.deleteOrdersById(id);
        ordersDao.deleteOrdersItemById(id);
    }


}
